// custom-tab-bar/custom-tab-bar.js
const app =getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    select:0,
    tabList: [
      {
        text: "推荐",
        pagePath:"/pages/recommend/recommend"
      },
      {
        text: "频道",
        pagePath:"/pages/channel/channel"
      },
      {
        text: "个人中心",
        pagePath:"/pages/user/user"
      }
    ]
  },
  attached(){
    this.setData({
      select:app.globalData.currentIndex
    })
  },
  /**
   * 组件的方法列表
   */
  methods: {
    swtichTap(e){
      let index = e.currentTarget.dataset.index
      let path = e.currentTarget.dataset.path;
      wx.switchTab({
        url: path,
      })
      app.globalData.currentIndex=index;
      this.setData({
        select:index
      })
    }
  }
})
